package com.dgut.usermanager.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Entity
@EntityListeners(AuditingEntityListener.class)
@DynamicInsert
@DynamicUpdate
@Data
@Table(name="user")
public class User implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    @Column(nullable=false)
    private String username;
    @Column(nullable=false)
    private String userIdCard;
    private String tel;
    //出入次数
    private Integer number;
    //最近一次出入时间
    @LastModifiedDate
    //@JsonFormat(pattern="yyyy-MM-dd")
    private Date lastestTime;
    private String lastestTemp;

    /*private String roomnumber;
    private String sex;
    private String phone;
    @Lob
    @Basic(fetch = FetchType.LAZY)
    private byte[] headimage;
    private String power;*/
    /*@ManyToOne
    @JoinColumn(name="administratorId")
    Administratorsq administrator;*/
    /*@OneToOne(mappedBy = "user", cascade = {CascadeType.MERGE, CascadeType.REFRESH}, optional = false)
    private UserAccount userAccount;
    @OneToOne(mappedBy = "user", cascade = {CascadeType.MERGE, CascadeType.REFRESH}, optional = false)
    House house;
    @OneToOne(mappedBy = "user", cascade = {CascadeType.MERGE, CascadeType.REFRESH}, optional = false)
    private Image image;*/
}
